(defun Example_TransformBy () ; / lineObj startPt endPt matList transMat) 

(vl-load-com)      ; Load ActiveX support
(setq acadObject   (vlax-get-acad-object))
(setq acadDocument (vla-get-ActiveDocument acadObject))
(setq mSpace       (vla-get-ModelSpace acadDocument))
(setq pSpace       (vla-get-PaperSpace acadDocument))

;; Create a line

 (setq startPt (getpoint "Pick the start point"))
 (setq endPt (vlax-3d-point (getpoint startPt "Pick the end point")))
 (setq lineObj0 (vla-addline mSpace (vlax-3d-point startPt) endPt))
 (setq lineObj1 (vla-addline pSpace (vlax-3d-point startPt) endPt))

;;; Initialize the transMat variable with a transformation matrix
;;; that will rotate an object by 90 degrees about the point(0,0,0).
;;; Begin by Creating a list of four lists, each containing four
;;; numbers, representing transformation matrix elements.

 (setq matList (list '(0 -0.5 0 0) '(0.5 0 0 0) '(0 0 0.5 0) '(0 0 0 1)));substitute list from (nth 2 (nentselp))) for matching transformations to inserts

;;; Use vlax-tmatrix to convert the list to a variant.

 (setq transmat (vlax-tmatrix matlist))
     
;;;  Transform the line using the defined transformation matrix

 (vla-transformby lineObj0 transMat)
 (vla-transformby lineObj1 transMat)
 (vla-zoomall acadObject)

 (princ "The line is transformed ")
 (princ)
)
